package com.huiqiao.lesson8.mybatis.controller;


import com.huiqiao.lesson8.mybatis.entity.SysUser;
import com.huiqiao.lesson8.mybatis.service.SysUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/user")
public class SysUserController extends BaseController {

    @Resource
    SysUserService userService;

    @PostMapping("/register")
    public AppResponse register() {
        SysUser user = new SysUser();
        user.setUserName("陈峰");
        user.setPhonenumber("17681101376");
        user.setNickName("小陈同学");
        user.setEmail("664839088@qq.com");
        user.setSex("0");//0男 1女 2未知
        user.setAvatar("https://www.baidu.com");
        user.setPassword("Aa123456");

        return userService.register(user) > 0 ? success() : fail();
    }
}
